home *** CD-ROM | disk | FTP | other *** search
/ World of Video / World of Video.iso / gfxprograms / conversion / pbmplus / doc / libpgm.doc < prev    next >
Text File  |  1995-02-13  |  4KB  |  199 lines

  1.  
  2.  
  3.  
  4. pgm(3)                      PBM Plus                       pgm(3)
  5.  
  6.  
  7.  
  8. NAME
  9.      pgm - functions to support portable graymap programs
  10.  
  11. SYNOPSIS
  12.      #include <pgm.h>
  13.      cc ... libpgm.a libpbm.a
  14.  
  15.  
  16. DESCRIPTION
  17.      TYPES AND CONSTANTS
  18.  
  19.      typedef unsigned char gray;
  20.      #define PGM_MAXMAXVAL 255
  21.      extern gray pgm_pbmmaxval;
  22.  
  23.      Each _g_r_a_y should contain only the values between _0 and
  24.      _P_G_M__M_A_X_M_A_X_V_A_L.  _p_g_m__p_b_m_m_a_x_v_a_l is the maxval used when a PGM
  25.      program reads a PBM file.  Normally it is 1; however, for
  26.      some programs, a larger value gives better results.
  27.  
  28.      PGM MEMORY MANAGEMENT
  29.  
  30.      gray **pgm_allocarray(int cols, int rows)
  31.  
  32.      Allocate an array of grays.
  33.  
  34.      gray *pgm_allocrow( int cols )
  35.  
  36.      Allocate a row of the given number of grays.
  37.  
  38.      void pgm_freearray( grayrow, rows )
  39.  
  40.      Free the array allocated with _p_g_m__a_l_l_o_c_a_r_r_a_y() containing
  41.      the given number of rows.
  42.  
  43.      pbm_freerow( grayrow )
  44.  
  45.      Free a row of grays.
  46.  
  47.      READING PBM FILES
  48.  
  49.      void
  50.      pgm_readpgminit( file, colsP, rowsP, maxvalP, formatP )
  51.      FILE *file;
  52.      int *colsP, *rowsP, *formatP;
  53.      gray *maxvalP;
  54.  
  55.      Read the header from a pgm file, filling in the rows, cols,
  56.      maxval and format variables.
  57.  
  58.      void
  59.      pgm_readpgmrow( file, grayrow, cols, maxval, format )
  60.  
  61.  
  62.  
  63. Printed 5/25/90                                                 1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. pgm(3)                      PBM Plus                       pgm(3)
  71.  
  72.  
  73.  
  74.      FILE *file;
  75.      gray *grayrow;
  76.      gray maxval;
  77.      int cols, format;
  78.  
  79.      Read a row of grays into the grayrow array.  Format and cols
  80.      were filled in by _p_g_m__r_e_a_d_p_g_m_i_n_i_t().
  81.  
  82.      gray **
  83.      pgm_readpgm( file, colsP, rowsP, maxvalP )
  84.      FILE *file;
  85.      int *colsP, *rowsP;
  86.      gray *maxvalP;
  87.  
  88.      Read an entire graymap file into memory, returning the allo-
  89.      cated array and filling in the rows, cols and maxval vari-
  90.      ables.  This function combines _p_g_m__r_e_a_d_p_g_m_i_n_i_t(),
  91.      _p_g_m__a_l_l_o_c_a_r_r_a_y() and _p_g_m__r_e_a_d_p_g_m_r_o_w().
  92.  
  93.      WRITING PGM FILES
  94.  
  95.      void
  96.      pgm_writepgminit( file, cols, rows, maxval )
  97.      FILE *file;
  98.      int cols, rows;
  99.      gray maxval;
  100.  
  101.      Write the header for a portable graymap file.
  102.  
  103.      void
  104.      pgm_writepgmrow( file, grayrow, cols, maxval )
  105.      FILE *file;
  106.      gray *grayrow;
  107.      int cols;
  108.      gray maxval;
  109.  
  110.      Write a row from a portable graymap.
  111.  
  112.      void
  113.      pgm_writepgm( file, bits, cols, rows, maxval )
  114.      FILE *file;
  115.      gray **bits;
  116.      int cols, rows;
  117.      gray maxval;
  118.  
  119.      Write the header and all data for a portable graymap.  This
  120.      function combines _p_g_m__w_r_i_t_e_p_g_m_i_n_i_t() and _p_g_m__w_r_i_t_e_p_g_m_r_o_w().
  121.  
  122. SEE ALSO
  123.      pgm(3), ppm(3)
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Printed 5/25/90                                                 2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. pgm(3)                      PBM Plus                       pgm(3)
  137.  
  138.  
  139.  
  140. AUTHOR
  141.      Manual by Tony Hansen.
  142.  
  143.      Copyright (C) 1989 by Jef Poskanzer.
  144.  
  145.      Permission to use, copy, modify, and distribute this
  146.      software and its documentation for any purpose and without
  147.      fee is hereby granted, provided that the above copyright
  148.      notice appear in all copies and that both that copyright
  149.      notice and this permission notice appear in supporting docu-
  150.      mentation.  This software is provided "as is" without
  151.      express or implied warranty.
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Printed 5/25/90                                                 3
  196.  
  197.  
  198.  
  199.